import "./assets/main.scss";

import { createApp } from "vue";
import { createPinia } from "pinia";
import router from "./router";
import App from "./App.vue";

// element-plus
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

// bootstrap icon
import "bootstrap-icons/font/bootstrap-icons.css";

// register svg icons
import "virtual:svg-icons-register";

import eventBus from "./plugins/eventBus";
import asyncRoute from "./plugins/asyncRoute";
import packagePlugin from "./packages/index.js";
import apiPlugin from "./api/index.js";

const app = createApp(App);

const pinia = createPinia();
app.use(pinia);
app.use(router);
app.use(ElementPlus);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
app.use(eventBus);
app.use(asyncRoute);
app.use(packagePlugin);

app.use(apiPlugin);

// vue3-context-menu
import "@imengyu/vue3-context-menu/lib/vue3-context-menu.css";
import ContextMenu from "@imengyu/vue3-context-menu";
app.use(ContextMenu);

app.mount("#app");
